<?php

namespace app\api\controller;

use app\api\model\Office as OfficeModel;
use app\BaseController;

class Office extends BaseController
{
    /* 获取 */
    public function getList()
    {
        $cid = input('cid', 0, 'intval');
        $type = input('type', 0, 'intval');
        $limit = input('limit', 0, 'intval');
        if ($limit) {
            $data = OfficeModel::order('sort asc')->limit($limit)->where(['cid' => $cid, 'type' => $type])->select();
        } else {
            $page = input('page', 1, 'intval');
            $perpage = 12;
            $data = OfficeModel::order('sort asc')->page($page, $perpage)->where(['cid' => $cid, 'type' => $type])->select();
        }
        return show(config('status.success'), '获取委员列表', $data);
    }
}
